package com.company;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static void main(String[] args) {
	// write your code here
        System.out.println("请输入字符串数组words[]的元素个个数");
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] words = new String[n];
        System.out.println("请输入字符串数组words[]的各个元素");
        for(int i = 0; i < n; i++)
        {
            words[i] = sc.next();
        }
        System.out.println(uniqueMorseRepresentations(words));

    }

    public static int uniqueMorseRepresentations(String[] words){
        String[] code = {".-","-...","-.-.","-..",".","..-.",
                "--.","....","..",".---","-.-",".-..","--",
                "-.","---",".--.","--.-",".-.","...","-",
                "..-","...-",".--","-..-","-.--","--.."};
        Set<String> ans = new HashSet<String>();
        for (String word : words) {
            StringBuffer translate = new StringBuffer();
            for (int i = 0; i < word.length(); i++) {
                char c = word.charAt(i);
                translate.append(code[c - 'a']);
            }
            ans.add(translate.toString());
        }
        return ans.size();

    }
}
